]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
If org.gnome.Panel exists on the bus, replace it rather than using gdb
authorColin Walters <walters@verbum.org>
Tue, 21 Jul 2009 14:50:18 +0000 (10:50 -0400)
committerColin Walters <walters@verbum.org>
Tue, 21 Jul 2009 17:29:49 +0000 (13:29 -0400)
Avoid depending on gdb for replacing an existing panel, since it
requires debuginfo and gdb installed.

Instead we grab the org.gnome.Panel DBus name, using DBus name
replacement semantics.

src/gnome-shell.in
src/shell-global.c

index f1d5e0ba4047db2e63ceffcf279d0104e269527c..eccea6c2a680cb17557ea966974659ad0fc4ae03 100755 (executable)
@@ -13,6 +13,7 @@ import tempfile
 import termios
 import time
 import errno
+import dbus
 
 def find_cmd (cmd_list):
     """
@@ -230,7 +231,16 @@ if options.wide:
 
 metacity_pid = pidof("metacity")
 compiz_pid = pidof("compiz.real") or pidof("compiz")
-gnome_panel_pid = pidof("gnome-panel")
+
+# In Gnome 2.26 the panel grabs a dbus name and allows replacement; use that.
+bus = dbus.Interface(dbus.SessionBus().get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'),
+                     'org.freedesktop.DBus')
+names = bus.ListNames()
+gnome_panel_dbus = 'org.gnome.Panel' in names
+if gnome_panel_dbus:
+    gnome_panel_pid = None
+else:
+    gnome_panel_pid = pidof("gnome-panel")
 
 # Run in Xephyr if gnome-panel is already running and the user didn't
 # specify --replace. Otherwise, run fullscreen
@@ -299,7 +309,7 @@ finally:
             if options.verbose:
                 print "Restarting Compiz"
             subprocess.Popen(["/usr/bin/compiz"])
-        if gnome_panel_pid:
+        if gnome_panel_dbus or gnome_panel_pid:
             if options.verbose:
                 print "Restarting gnome-panel"
             subprocess.Popen(["/usr/bin/gnome-panel"])
index 6a803b5d8b90992ac155d4dcb6b3d7f3a0e85831..ea316364b05dfaf050879e40b0945c0b22ff69f6 100644 (file)
@@ -739,11 +739,23 @@ shell_global_grab_dbus_service (ShellGlobal *global)
        */
       exit (0);  
     }
-  
+
+  /* Also grab org.gnome.Panel to replace any existing panel process */
+  if (!dbus_g_proxy_call (bus, "RequestName", &error,
+                          G_TYPE_STRING, "org.gnome.Panel",
+                          G_TYPE_UINT, DBUS_NAME_FLAG_REPLACE_EXISTING | DBUS_NAME_FLAG_DO_NOT_QUEUE,
+                          G_TYPE_INVALID,
+                          G_TYPE_UINT, &request_name_result,
+                          G_TYPE_INVALID))
+    {
+      g_print ("failed to acquire org.gnome.Panel: %s\n", error->message);
+      exit (1);
+    }
+
   g_object_unref (bus);
 }
 
-void 
+void
 shell_global_start_task_panel (ShellGlobal *global)
 {
   const char* panel_args[] = {"gnomeshell-taskpanel", SHELL_DBUS_SERVICE, NULL};